package com.xlong.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import cn.dev33.satoken.interceptor.SaRouteInterceptor;

@Configuration
@EnableWebMvc
public class SaTokenConfigure implements WebMvcConfigurer {
	// 注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册 Sa-Token 的路由拦截器
        registry.addInterceptor(new SaRouteInterceptor())
            .addPathPatterns("/user/**")
            .excludePathPatterns("/user/auth/dologin")
            .excludePathPatterns("/swagger-ui/**", "/swagger-resources/**","/swagger-ui.html","/api/v2/api-docs","/webjars/**"); 
    }
}
